<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <!-- 满足有些用户在手机端访问的需要 -->

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <title>用户管理</title>
    <!-- 线上环境 -->
    <link rel="stylesheet" href="/static/css/dist/component-min.css">
    <link rel="stylesheet" href="/static/plugins/jbox/jbox-min.css">

    <!--vue-->
    <script src="/static/vue/vue.js"></script>
    <!--element ui-->
    <script src="/static/element/index.js"></script>
    <link rel="stylesheet" href="/static/element/index.css">
    <style>
        .el-table__empty-block {
            height: 0;
        }
    </style>

</head>
<body class="cp-bodybox">
<div id="app">
    <#include "/common/header-fg.html" />

    <div class="container">
        <div class="inner clearfix">
            <#include "/common/left-menu-fg.html" />

            <div class="content-right">
                <h1 class="content-right-title">商品审核日志</h1>
                <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <span style="line-height: 36px;">筛选区</span>
                        <div style="float: right">
                            <el-button type="primary" @click.native.prevent="getList">查询</el-button>
                            <el-button type="primary" @click.native.prevent="clearSearch">清空查询条件</el-button>
                        </div>
                    </div>
                    <el-form :inline="true" ref="search" :model="search" label-width="80px">
                        <el-row>
                            <el-col :span="12">
                                <el-form-item label="商品">
                                    <el-input v-model="search.itemName" placeholder="名称"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="审核人">
                                    <el-input v-model="search.checkUser" placeholder="名称"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="24">
                                <el-form-item label="结果">
                                    <el-select v-model="search.checkResult" placeholder="请选择结果">
                                        <el-option
                                                v-for="item in stateList"
                                                :label="item.label"
                                                :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="24">
                                <el-form-item label="审核时间">
                                    <el-date-picker
                                            v-model="search.checkTimeStart"
                                            type="date"
                                            placeholder="选择日期">
                                    </el-date-picker>&nbsp;至&nbsp;
                                    <el-date-picker
                                            v-model="search.checkTimeEnd"
                                            type="date"
                                            placeholder="选择日期">
                                    </el-date-picker>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-card>
                <el-card class="box-card" style="margin-top: 10px">
                    <el-table
                            :data="checkList"
                            border
                            style="width: 100%">
                        <el-table-column
                                inline-template
                                label="序号"
                                width="80">
                            <div>{{ $index+pageSize*(currentPage-1)+1 }}</div>
                        </el-table-column>
                        <el-table-column
                                prop="itemName"
                                label="商品"
                                width="180">
                        </el-table-column>
                        <el-table-column
                                prop="checkUser"
                                label="审核人">
                        </el-table-column>
                        <el-table-column
                                prop="checkResult"
                                :formatter="formatResult"
                                label="审核结果">
                        </el-table-column>
                        <el-table-column
                                prop="checkDesc"
                                show-overflow-tooltip
                                label="审核描述">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="checkTime"
                                :formatter="formatterTime"
                                label="审核时间">
                        </el-table-column>
                    </el-table>
                    <el-pagination
                            @current-change="handleCurrentPageChange"
                            :current-page="currentPage"
                            :page-size="pageSize"
                            layout="total, prev, pager, next"
                            :total="totalCount">
                    </el-pagination>
                </el-card>

            </div>
            <!-- end content-right -->

            <a href="javascript:;" class="btn-leftMenuFold" id="j-btn-leftMenuFold"></a>
        </div>
    </div>
    <!-- end container -->

    <!--gonggao-->

    <!--tip-->
    <div class="footer">© 2017 , Inc. All rights reserved.</div>
    <!-- end footer -->
    <div class="fixedBar" style="right: -78px;">
        <ul>
            <template v-for="(item, index) in leftMenuList">
                <li v-if="index==0" :class="'shopManager' + index + ' cur'"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
                <li v-else :class="'shopManager' + index"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
            </template>
        </ul>
        <a href="javascript:;" class="fixedBar-btn" id="j-fixedBar-btn"></a>
    </div>
    <a href="#" id="j-gotop" class="gotop" title="回到顶部" style="left: 1920.59px;"></a>

</div>
<script src="/static/js/dist/lib-min.js"></script>
<script src="/static/js/dist/list.js"></script>
<script src="/static/js/dist/component-min.js"></script>

<!-- 引入api -->
<script src="/static/js/api.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function(){
            return {
                user: ${(user)!'null'},
                headerNavList: list.headerNavList,
                stateList: [
                    {
                        label: '通过',
                        value: 1
                    },
                    {
                        label: '不通过',
                        value: 0
                    }
                ],
                accountNavList: list.accountNavList,
                leftMenuList: list.menu,
                search: {
                    checkUser: '',
                    itemName: '',
                    nature: '',
                    checkResult: '',
                    checkTimeStart: '',
                    checkTimeEnd: ''
                },
                checkList: [],
                currentPage: list.currentPage,
                pageSize: list.pageSize,
                totalCount: 0
            }
        },
        mounted: function () {
            this.getList();
        },
        methods: {
            handleCurrentPageChange(val) {
                this.currentPage = val;
                this.getList();
            },
            formatResult (row, column) {
                if (row.checkResult === 1) {
                    return "通过";
                } else {
                    return "不通过";
                }
            },
            clearSearch () {
                this.search = {
                    checkUser: '',
                    itemName: '',
                    nature: '',
                    checkResult: '',
                    checkTimeStart: '',
                    checkTimeEnd: ''
                }
                this.getList();
            },
            formatterTime (row, column) {
                if (row.checkTime !== undefined && (row.checkTime + "").length >= 10) {
                    return (row.checkTime + "").substring(0, 10);
                } else {
                    return row.checkTime;
                }
            },
            getList () {
                let that = this
                let obj = {
                    checkResult: this.search.checkResult,
                    itemName: this.search.itemName,
                    checkTimeStart: this.formatTime(this.search.checkTimeStart, true),
                    checkTimeEnd: this.formatTime(this.search.checkTimeEnd, true),
                    checkUser: this.search.checkUser,
                    currentPage: this.currentPage,
                    pageSize: this.pageSize,
                    isAll: 0
                }
                let loading = this.$loading({fullscreen: true, lock: true});
                this.http('/item/check/list',obj,function (res) {
                    if(res.status === 200){
                        that.checkList = res.data.list;
                        that.totalCount = res.data.total;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert(res.errMsg, '提示', {
                            confirmButtonText: '确定',
                        });
                    }
                }, function (res) {
                    loading.close();
                    that.$alert("服务器错误", '提示', {
                        confirmButtonText: '确定',
                    });
                })
            }
        }
    })
</script>

<!-- 20170105 --></body>
</html>